OPTIONAL libpng

REQUIRES DLL-TOOLS

LIBRARY libpng13

4 cimport: png_create_write_struct
1 cimport: png_create_info_struct
\ 1 cimport: png_jmpbuf
2 void cimport: png_init_io
9 void cimport: png_set_IHDR
2 void cimport: png_write_info
2 void cimport: png_write_row
2 void cimport: png_write_end

#define PNG_LIBPNG_VER_STRING z" 1.2.39"

#define PNG_TEXT_COMPRESSION_NONE_WR -3
#define PNG_TEXT_COMPRESSION_zTXt_WR -2
#define PNG_TEXT_COMPRESSION_NONE    -1
#define PNG_TEXT_COMPRESSION_zTXt     0
#define PNG_ITXT_COMPRESSION_NONE     1
#define PNG_ITXT_COMPRESSION_zTXt     2

( These describe the color_type field in png_info. )
( color type masks )
#define PNG_COLOR_MASK_PALETTE    1
#define PNG_COLOR_MASK_COLOR      2
#define PNG_COLOR_MASK_ALPHA      4

( color types.  Note that not all combinations are legal )
#define PNG_COLOR_TYPE_GRAY 0
#define PNG_COLOR_TYPE_PALETTE  PNG_COLOR_MASK_COLOR PNG_COLOR_MASK_PALETTE OR
#define PNG_COLOR_TYPE_RGB        PNG_COLOR_MASK_COLOR
#define PNG_COLOR_TYPE_RGB_ALPHA   PNG_COLOR_MASK_COLOR PNG_COLOR_MASK_ALPHA OR
#define PNG_COLOR_TYPE_GRAY_ALPHA   PNG_COLOR_MASK_ALPHA
( aliases )
#define PNG_COLOR_TYPE_RGBA  PNG_COLOR_TYPE_RGB_ALPHA
#define PNG_COLOR_TYPE_GA  PNG_COLOR_TYPE_GRAY_ALPHA

( This is for compression type. PNG 1.0-1.2 only define the single type. )
#define PNG_COMPRESSION_TYPE_BASE 0 ( Deflate method 8, 32K window )
#define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE

( This is for filter type. PNG 1.0-1.2 only define the single type. )
#define PNG_FILTER_TYPE_BASE      0 ( Single row per-byte filtering )
#define PNG_INTRAPIXEL_DIFFERENCING 64 ( Used only in MNG datastreams )
#define PNG_FILTER_TYPE_DEFAULT   PNG_FILTER_TYPE_BASE

( These are for the interlacing type.  These values should NOT be changed. )
#define PNG_INTERLACE_NONE        0 ( Non-interlaced image )
#define PNG_INTERLACE_ADAM7       1 ( Adam7 interlacing )
#define PNG_INTERLACE_LAST        2 ( Not a valid value )

{

( These are for the oFFs chunk.  These values should NOT be changed. )
#define PNG_OFFSET_PIXEL          0 ( Offset in pixels )
#define PNG_OFFSET_MICROMETER     1 ( Offset in micrometers (1/10^6 meter) )
#define PNG_OFFSET_LAST           2 ( Not a valid value )

( These are for the pCAL chunk.  These values should NOT be changed. )
#define PNG_EQUATION_LINEAR       0 ( Linear transformation )
#define PNG_EQUATION_BASE_E       1 ( Exponential base e transform )
#define PNG_EQUATION_ARBITRARY    2 ( Arbitrary base exponential transform )
#define PNG_EQUATION_HYPERBOLIC   3 ( Hyperbolic sine transformation )
#define PNG_EQUATION_LAST         4 ( Not a valid value )

( These are for the sCAL chunk.  These values should NOT be changed. )
#define PNG_SCALE_UNKNOWN         0 ( unknown unit (image scale) )
#define PNG_SCALE_METER           1 ( meters per pixel )
#define PNG_SCALE_RADIAN          2 ( radians per pixel )
#define PNG_SCALE_LAST            3 ( Not a valid value )

( These are for the pHYs chunk.  These values should NOT be changed. )
#define PNG_RESOLUTION_UNKNOWN    0 ( pixels/unknown unit (aspect ratio) )
#define PNG_RESOLUTION_METER      1 ( pixels/meter )
#define PNG_RESOLUTION_LAST       2 ( Not a valid value )

( These are for the sRGB chunk.  These values should NOT be changed. )
#define PNG_sRGB_INTENT_PERCEPTUAL 0
#define PNG_sRGB_INTENT_RELATIVE   1
#define PNG_sRGB_INTENT_SATURATION 2
#define PNG_sRGB_INTENT_ABSOLUTE   3
#define PNG_sRGB_INTENT_LAST       4 ( Not a valid value )

( This is for text chunks )
#define PNG_KEYWORD_MAX_LENGTH     79

( Maximum number of entries in PLTE/sPLT/tRNS arrays )
#define PNG_MAX_PALETTE_LENGTH    256

( These determine if an ancillary chunk's data has been successfully read
 * from the PNG header, or if the application has filled in the corresponding
 * data in the info_struct to be written into the output file.  The values
 * of the PNG_INFO_<chunk> defines should NOT be changed.
 )
#define PNG_INFO_gAMA $0001
#define PNG_INFO_sBIT $0002
#define PNG_INFO_cHRM $0004
#define PNG_INFO_PLTE $0008
#define PNG_INFO_tRNS $0010
#define PNG_INFO_bKGD $0020
#define PNG_INFO_hIST $0040
#define PNG_INFO_pHYs $0080
#define PNG_INFO_oFFs $0100
#define PNG_INFO_tIME $0200
#define PNG_INFO_pCAL $0400
#define PNG_INFO_sRGB $0800   ( GR-P, 0.96a )
#define PNG_INFO_iCCP $1000   ( ESR, 1.0.6 )
#define PNG_INFO_sPLT $2000   ( ESR, 1.0.6 )
#define PNG_INFO_sCAL $4000   ( ESR, 1.0.6 )
#define PNG_INFO_IDAT $8000L  ( ESR, 1.0.6 )



( Transform masks for the high-level interface )
#define PNG_TRANSFORM_IDENTITY       $0000    ( read and write )
#define PNG_TRANSFORM_STRIP_16       $0001    ( read only )
#define PNG_TRANSFORM_STRIP_ALPHA    $0002    ( read only )
#define PNG_TRANSFORM_PACKING        $0004    ( read and write )
#define PNG_TRANSFORM_PACKSWAP       $0008    ( read and write )
#define PNG_TRANSFORM_EXPAND         $0010    ( read only )
#define PNG_TRANSFORM_INVERT_MONO    $0020    ( read and write )
#define PNG_TRANSFORM_SHIFT          $0040    ( read and write )
#define PNG_TRANSFORM_BGR            $0080    ( read and write )
#define PNG_TRANSFORM_SWAP_ALPHA     $0100    ( read and write )
#define PNG_TRANSFORM_SWAP_ENDIAN    $0200    ( read and write )
#define PNG_TRANSFORM_INVERT_ALPHA   $0400    ( read and write )
#define PNG_TRANSFORM_STRIP_FILLER   $0800    ( WRITE only, deprecated )
( Added to libpng-1.2.34 )
#define PNG_TRANSFORM_STRIP_FILLER_BEFORE $0800  ( WRITE only )
#define PNG_TRANSFORM_STRIP_FILLER_AFTER  $1000  ( WRITE only )

( Flags for MNG supported features )
#define PNG_FLAG_MNG_EMPTY_PLTE     $01
#define PNG_FLAG_MNG_FILTER_64      $04
#define PNG_ALL_MNG_FEATURES        $05

( Flags for png_set_filter() to say which filters to use.  The flags
 * are chosen so that they don't conflict with real filter types
 * below, in case they are supplied instead of the #defined constants.
 * These values should NOT be changed.
 )
#define PNG_NO_FILTERS     $00
#define PNG_FILTER_NONE    $08
#define PNG_FILTER_SUB     $10
#define PNG_FILTER_UP      $20
#define PNG_FILTER_AVG     $40
#define PNG_FILTER_PAETH   $80
#define PNG_ALL_FILTERS PNG_FILTER_NONE PNG_FILTER_SUB OR PNG_FILTER_UP OR
                         PNG_FILTER_AVG OR PNG_FILTER_PAETH OR

( Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
 * These defines should NOT be changed.
 )
#define PNG_FILTER_VALUE_NONE  0
#define PNG_FILTER_VALUE_SUB   1
#define PNG_FILTER_VALUE_UP    2
#define PNG_FILTER_VALUE_AVG   3
#define PNG_FILTER_VALUE_PAETH 4
#define PNG_FILTER_VALUE_LAST  5

/* Heuristic used for row filter selection.  These defines should NOT be
 * changed.
 */
#define PNG_FILTER_HEURISTIC_DEFAULT    0  /* Currently "UNWEIGHTED" */
#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1  /* Used by libpng < 0.95 */
#define PNG_FILTER_HEURISTIC_WEIGHTED   2  /* Experimental feature */
#define PNG_FILTER_HEURISTIC_LAST       3  /* Not a valid value */

{
typedef struct png_info_struct
   /* the following are necessary for every PNG file */
   png_uint_32 width;       /* width of image in pixels (from IHDR) */
   png_uint_32 height;      /* height of image in pixels (from IHDR) */
   png_uint_32 valid;       /* valid chunk data (see PNG_INFO_ below) */
   png_uint_32 rowbytes;    /* bytes needed to hold an untransformed row */
   png_colorp palette;      /* array of color values (valid & PNG_INFO_PLTE) */
   png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
   png_uint_16 num_trans;   /* number of transparent palette color (tRNS) */
   png_byte bit_depth;      /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
   png_byte color_type;     /* see PNG_COLOR_TYPE_ below (from IHDR) */
   /* The following three should have been named *_method not *_type */
   png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
   png_byte filter_type;    /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
   png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */

   /* The following is informational only on read, and not used on writes. */
   png_byte channels;       /* number of data channels per pixel (1, 2, 3, 4) */
   png_byte pixel_depth;    /* number of bits per pixel */
   png_byte spare_byte;     /* to align the data, and for future use */
   png_byte signature[8];   /* magic bytes read by libpng from start of file */

   /* The rest of the data is optional.  If you are reading, check the
    * valid field to see if the information in these are valid.  If you
    * are writing, set the valid field to those chunks you want written,
    * and initialize the appropriate fields below.
    */

}
